﻿namespace StyleCop.CSharp.JslOrderingRules
{
    /// <summary>
    /// Rules for ordering elements.
    /// </summary>
    [SourceAnalyzer(typeof(CsParser))]
    public class RuleAnalyzer : SourceAnalyzer
    {
        /// <summary>
        /// Members should be in alphabetically order.
        /// </summary>
        public static readonly string MembersMustBeInAlphabeticalOrder = "MembersMustBeInAlphabeticalOrder";

        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="RuleAnalyzer"/> class.
        /// </summary>
        public RuleAnalyzer()
        {
        }
        #endregion Constructors

        #region Public Methods
        /// <summary>
        /// Analyzes the document.
        /// </summary>
        /// <param name="document">The document.</param>
        public override void AnalyzeDocument(CodeDocument document)
        {
            CsDocument csharpDocument = (CsDocument)document;

            MembersMustBeInAlphabeticalOrder rules = new MembersMustBeInAlphabeticalOrder(this);
            rules.Document = csharpDocument;
            rules.AnalyzeDocument();
        }
        #endregion Public Methods
    }
}